<template>
  <div>
    <h2 class="badge-title">
      <span v-if="routerId === '11'">徽章</span>
      <span v-if="routerId === '12'">奖牌</span>
      <span v-if="routerId === '13'">钥匙扣</span>
      <span v-if="routerId === '14'">书签</span>
      <span v-if="routerId === '15'">纪念币</span>
      <span v-if="routerId === '16'">奖杯</span>
      <span v-if="routerId === '17'">冰箱贴</span>
      <span v-if="routerId === '18'">挂件/钥匙链</span>
      <span v-if="routerId === '19'">纪念盘</span>
      <span v-if="routerId === '20'">开瓶器</span>
      <span v-if="routerId === '21'">袖扣/领带夹</span>
      <span v-if="routerId === '22'">其他/定制</span>
    </h2>
      <div class="badge-list">
        <div class="badge-item" v-for="(item, idx) in currentList" :key="idx">
          <img :src="item.img" :alt="item.name" />
          <div class="badge-name">{{ item.name }}</div>
        </div>
      </div>
    </div>
    
</template>

<script>
import { badgeList, medalList } from '@/components/navRight/model/productsData'
export default {
  name: 'ProductsIndex',
  data() {
    return {
      badgeList,
      medalList, // 奖牌
      routerId: ''
    }
  },
  computed: {
    currentList() {
      // 根据不同的routerId返回对应的数组
      switch (this.routerId) {
        case '11': // 徽章
          return this.badgeList
        case '12': // 奖牌
          return this.medalList
        case '13': // 钥匙扣
          return this.badgeList // 暂时使用徽章数据，后续可以添加钥匙扣数据
        case '14': // 书签
          return this.badgeList // 暂时使用徽章数据，后续可以添加书签数据
        case '15': // 纪念币
          return this.badgeList // 暂时使用徽章数据，后续可以添加纪念币数据
        case '16': // 奖杯
          return this.badgeList // 暂时使用徽章数据，后续可以添加奖杯数据
        case '17': // 冰箱贴
          return this.badgeList // 暂时使用徽章数据，后续可以添加冰箱贴数据
        case '18': // 挂件/钥匙链
          return this.badgeList // 暂时使用徽章数据，后续可以添加挂件数据
        case '19': // 纪念盘
          return this.badgeList // 暂时使用徽章数据，后续可以添加纪念盘数据
        case '20': // 开瓶器
          return this.badgeList // 暂时使用徽章数据，后续可以添加开瓶器数据
        case '21': // 袖扣/领带夹
          return this.badgeList // 暂时使用徽章数据，后续可以添加袖扣数据
        case '22': // 其他/定制
          return this.badgeList // 暂时使用徽章数据，后续可以添加定制数据
        default:
          return this.badgeList
      }
    }
  },
  watch: {
    '$route.params.id': {
      handler(newVal) {
        this.routerId = newVal
      },
      immediate: true
    }
  }
}
</script>

<style scoped>
.badge-title {
  font-size: 24px;
  font-weight: bold;
  color: #1b4e54;
  margin-bottom: 18px;
  border-left: 4px solid #1b4e54;
  padding-left: 12px;
  letter-spacing: 1px;
}
.badge-list {
  display: flex;
  flex-wrap: wrap;
  gap: 40px 40px;
  justify-content: space-between;
}
.badge-item {
  width: calc(33.333% - 27px);
  display: flex;
  flex-direction: column;
  align-items: center;
  background: transparent;
  padding: 20px 10px;
  transition: all 0.3s ease;
}
.badge-item:hover {
  transform: translateY(-2px);
}
.badge-item img {
  width: 250px;
  height: 250px;
  object-fit: contain;
  border-radius: 8px;
  background: #f5f5f5;
}
.badge-name {
  margin-top: 16px;
  font-size: 16px;
  font-weight: 500;
  text-align: center;
  color: #333;
}
@media (max-width: 900px) {
  .badge-list {
    justify-content: center;
    gap: 30px 20px;
  }
  .badge-item {
    width: calc(50% - 15px);
    padding: 15px 8px;
  }
  .badge-item img {
    width: 180px;
    height: 180px;
  }
}

@media (max-width: 768px) {
  .badge-title {
    font-size: 20px;
    margin-bottom: 15px;
    padding-left: 10px;
  }
  
  .badge-list {
    gap: 20px 15px;
  }
  
  .badge-item {
    width: calc(50% - 10px);
    padding: 12px 6px;
  }
  
  .badge-item img {
    width: 140px;
    height: 140px;
  }
  
  .badge-name {
    font-size: 14px;
    margin-top: 12px;
  }
}

@media (max-width: 480px) {
  .badge-title {
    font-size: 18px;
    margin-bottom: 12px;
    padding-left: 8px;
  }
  
  .badge-list {
    gap: 15px 10px;
    justify-content: center;
  }
  
  .badge-item {
    width: calc(50% - 5px);
    padding: 10px 5px;
  }
  
  .badge-item img {
    width: 160px;
    height: 160px;
  }
  
  .badge-name {
    font-size: 13px;
    margin-top: 10px;
  }
}
</style> 